import { getCouponListAPI } from '@/api/coupon'
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useCouponStore = defineStore('coupon', () => {
  const couponList = ref<any>([])

  // 获取优惠券列表
  const getCouponList = async () => {
    couponList.value = await getCouponListAPI()
  }
  getCouponList()

  const selectedCoupon = ref<any>({})

  return {
    couponList,
    getCouponList,
    selectedCoupon
  }
})
